/*
 * Copyright (C) 2017 The MoonLake Authors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


package com.minecraft.moonlake.legendaryweaponrel.weapons.armor;

import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

public class Wrath extends WeaponAbstractArmorBase {

    public Wrath() {
        super("wrath", "&b火神甲", Material.IRON_CHESTPLATE);
    }

    @Override
    public String[] getLore() {
        return new String[] {
                "&7被攻击时有几率 &a15% &7使攻击者燃烧 &a4 &7秒"
        };
    }

    @Override
    protected void onDamage(EntityDamageByEntityEvent event, Player player, LivingEntity dmg) {
        // 处理玩家护甲受伤
        int value = (int) (Math.random() * 100);
        int chance = value <= 15 ? 1 : -1; // 几率 15 燃烧, 否则什么也不做

        if(chance == 1) dmg.setFireTicks(4 * 20); // 为 1 则燃烧攻击者
    }
}
